package com.hsmpay.mobile.dao.brokerage;

import com.hsmpay.common.dao.BaseDao;
import com.hsmpay.mobile.pojo.brokerage.BrokEachOrder;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 佣金 每笔订单 根据 机构树保存各一笔
 *
 * @param <Entity>
 * @param <Query>
 * @author 颜铃璋
 *         建立时间：2014-6-24
 */
public interface BrokEachOrderDao<Entity extends Serializable, Query extends Object> extends BaseDao<Entity, Query> {
    /**
     * 调用存储过程 计算佣金
     *
     * @param roleId
     * @param roleType
     * @param orgId
     * @param transMoney
     * @param fee
     * @param feeRate
     * @param orderNum
     * @param clientType
     * @param orderDate
     * @param revenueFee
     * @param userId
     * @return
     * @throws SQLException
     */
    public int proBrokMobile(Long roleId, Integer roleType, Long orgId, Double transMoney, Double fee, Double feeRate, String orderNum, Integer clientType, Date orderDate, Double revenueFee, Long userId) throws SQLException;

    /**
     * 删除订单
     *
     * @param orderNum
     * @return
     * @throws SQLException
     */
    public int deleteBrokEachOrderByOrderNum(String orderNum) throws SQLException;

    /**
     * 分组查询 机构 所得佣金（总的）
     * @param param
     * @return
     * @throws SQLException
     */
    public List<BrokEachOrder> searchEachOGBOrgIdList(Map<String,Object> param)throws SQLException;

    /**
     * 分组查询 机构 所得佣金
     * @param param
     * @return
     * @throws SQLException
     */
    public List<BrokEachOrder> searchEachOGBOrgIdRoleIdList(Map<String,Object> param)throws SQLException;

    /**
     * 更新生成了结算订单的佣金订单
     * @param param
     * @return
     * @throws SQLException
     */
    public Integer updateBrokEachOrderClearStatusByOrg(Map<String,Object> param) throws SQLException;

    /**
     * 查询生成佣金结算订单的收款订单的时间范围
     * @param param
     * @return
     * @throws SQLException
     */
    public BrokEachOrder minAndMaxCreatDateInTransOrder(Map<String,Object> param) throws SQLException;

    /**
     * 根据id更新BrokEachOrder状态
     * @param brokEachOrder
     * @return
     * @throws SQLException
     */
    public Integer updateClearStatusById(BrokEachOrder brokEachOrder) throws SQLException;
}
